import React from 'react'
import {
    Switch,
    Route,
    Link,
    HashRouter
} from 'react-router-dom'
import {Layout, Menu, Breadcrumb, Icon} from 'antd';

const {SubMenu} = Menu;

const {Header, Footer, Sider, Content} = Layout;

import MovieList from './MovieList.jsx'
import MovieDetail from './MovieDetail.jsx';

export default class extends React.Component {
    constructor(props) {
        super(props)
        //初始化state
        this.state = {
            params: this.props.match.params
        };
    }


    //默认属性
    static defaultProps = {}
    render() {
        return <div>
            <Layout>
                <Sider style={{marginRight: 2}}>
                    <Menu
                        mode="inline"
                        defaultSelectedKeys={window.location.hash.split("/")[2]}
                        style={{height: '100%', borderRight: 0}}
                    >
                        {console.log(window.location.hash.split("/")[2])}
                        <Menu.Item key="in_theaters">
                            <Link to="/movie/in_theaters/1">正在热映</Link>
                        </Menu.Item>
                        <Menu.Item key="coming_soon">
                            <Link to="/movie/coming_soon/1">即将上映</Link>
                        </Menu.Item>
                        <Menu.Item key="top250">
                            <Link to="/movie/top250/1">TOP250</Link>
                        </Menu.Item>
                    </Menu>
                </Sider>
                <Content style={{background: '#fff', minHeight: 280, height: "100%"}}>
                    <Switch>
                        <Route path="/movie/detail/:id" component={MovieDetail}/>
                        <Route path="/movie/:type/:start" component={MovieList}/>
                    </Switch>
                </Content>
            </Layout>
        </div>
    }
}



